Skip to content

Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH#61182

Merged
amoghrajesh merged 2 commits intoapache:mainfrom
Eason09053360:fix-recursion-limit-test
Feb 24, 2026
Merged

Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH#61182
amoghrajesh merged 2 commits intoapache:mainfrom
Eason09053360:fix-recursion-limit-test

Conversation

@Eason09053360
Copy link
Contributor

This PR fixes a flaky unit test test_serde_serialize_recursion_limit in task-sdk.

The test was previously using sys.getrecursionlimit() - 1 to simulate the recursion depth. However, this system limit (often 1000) does not match the internal MAX_RECURSION_DEPTH constant (which is 10) used in the serialize function.

Because of this mismatch, the depth check in serialize passed (since 999 != 10), causing the function to attempt to serialize the empty object(), resulting in a TypeError instead of the expected RecursionError.

Verification

Ran the test locally with pytest and it passed:

截圖 2026-01-29 凌晨3 17 53

Changes:

  • Imported MAX_RECURSION_DEPTH from airflow.sdk.serde.serde.
  • Updated the test to use this constant for the depth parameter to correctly trigger the RecursionError.

closes: #51915

@Eason09053360
Copy link
Contributor Author

Thanks for the approval! @amoghrajesh Is there anything else required from my end to get this merged?
Happy to address any other feedback.

@Eason09053360 Eason09053360 force-pushed the fix-recursion-limit-test branch from a75d550 to 5bec499 Compare February 5, 2026 16:09
@Eason09053360 Eason09053360 force-pushed the fix-recursion-limit-test branch from 5bec499 to 4074f03 Compare February 21, 2026 13:40
@Eason09053360 Eason09053360 force-pushed the fix-recursion-limit-test branch from 4074f03 to 008f7d7 Compare February 22, 2026 16:14
@amoghrajesh amoghrajesh merged commit 1dafcff into apache:main Feb 24, 2026
101 checks passed
@nailo2c
Copy link
Contributor

nailo2c commented Feb 24, 2026

Nice fix, Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate CI failure of test_serde_serialize_recursion_limit

4 participants